package
{
	
	import com.mcglib.flac.ScrollList;

	import flash.display.SimpleButton;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageDisplayState;
	import flash.display.StageScaleMode;
	import flash.events.MouseEvent;
	
	
	public class ScrollListTest extends Sprite
	{
		private var scrollProxyList:ScrollList;
		
		private var datas:Array = [];
		
		private var list:com.mcglib.flac.ScrollList;
		
		
		public function ScrollListTest()
		{
			stage.scaleMode=StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			stage.displayState = StageDisplayState.NORMAL;
			
			var ui:listex = new listex;

			list = new ScrollList(ui);
			list.rendererClass = Renderer;
			list.present();
			
			
			
			ui.btnAdd.addEventListener(MouseEvent.CLICK,updateData);
			ui.btnDec.addEventListener(MouseEvent.CLICK,updateData);
			
			addChild(ui);
		}
		
		private function updateData(e:MouseEvent):void{
			var btn:SimpleButton = e.currentTarget as SimpleButton;
			if(btn.name=="btnAdd"){
				datas.push(datas.length);
			}else if(datas.length>0){
				datas.splice(datas.length-1,1);
			}
			//trace(datas);
			list.dataProvide = datas;
			list.present();
		}
		
		

		
	}
}